package com.entor.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.entor.model.Dictionary;
import com.entor.service.BaseServiceI;
import com.entor.util.Msg;

@Controller
@RequestMapping("/dic")
public class DicController extends BaseController{

	@Resource(name="dicService")
	private BaseServiceI<Dictionary> bsi;
	
	@RequestMapping("/index")
	public String index(){
		return "/dictionary/dicIndex";
	}
	
	@RequestMapping("/find")
	@ResponseBody
	public List<Dictionary> find(Dictionary d){
		return bsi.find(d);
	}
	
	@RequestMapping("/add")
	@ResponseBody
	public Msg insert(Dictionary d){
		return bsi.add(d);
	}
	
	@RequestMapping("/edit")
	@ResponseBody
	public Msg edit(Dictionary d){
		return bsi.edit(d);
	}
	
	@RequestMapping("/remove")
	@ResponseBody
	public Msg remove(Dictionary d){
		return bsi.remove(d.getId());
	}
}
